package com.foxzzz.temporary;

import java.util.Arrays;
import java.util.List;

public class Solution1033 {
    public int[] numMovesStones(int a, int b, int c) {
        List<Integer> list = Arrays.asList(a, b, c);
        list.sort((i1, i2) -> i1 > i2 ? 1 : -1);
        int maxStep = 0;
        int minStep = 0;
        int distance1 = list.get(1) - list.get(0);
        int distance2 = list.get(2) - list.get(1);
        if (distance1 > distance2) {
            maxStep = distance1;
            minStep = distance2;
        } else {
            maxStep = distance2;
            minStep = distance1;
        }
        int[] result = new int[2];
        result[1] = maxStep + minStep - 2;
        result[0] = maxStep == 2 || minStep == 2 ? 1 : (maxStep > 2 ? 1 : 0)+(minStep > 2 ? 1 : 0);
        return result;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1033().numMovesStones(7,4,1)[0]);
    }
}
